# Maintainer: Sebastian Ehlert <awvwgk@disroot.org>

_pyname=ford
_realname=${_pyname}
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=6.1.8
pkgrel=1
pkgdesc="FORD, standing for FORtran Documenter, is an automatic documentation generator for modern Fortran programs (mingw-w64)"
url="https://github.com/Fortran-FOSS-Programmers/ford"
license=("GPL-3.0-or-later")
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-beautifulsoup4"
         "${MINGW_PACKAGE_PREFIX}-python-graphviz"
         "${MINGW_PACKAGE_PREFIX}-python-jinja"
         "${MINGW_PACKAGE_PREFIX}-python-markdown"
         "${MINGW_PACKAGE_PREFIX}-python-markdown-include"
         "${MINGW_PACKAGE_PREFIX}-python-md-environ"
         "${MINGW_PACKAGE_PREFIX}-python-pygments"
         "${MINGW_PACKAGE_PREFIX}-python-toposort"
         "${MINGW_PACKAGE_PREFIX}-python-tqdm")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/Fortran-FOSS-Programmers/ford/archive/v${pkgver}.tar.gz")
sha256sums=('ffd6fdfcad05d1d1e3ad7d877841a5cf5ba3b1d4ded01c02285bf0e7341b6cf2')

prepare() {
  cd ${srcdir}
  rm -rf python-build-${CARCH} | true
  cp -r "${_pyname}-${pkgver}" "python-build-${CARCH}"
}

build() {
  msg "Python build for ${CARCH}"
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
      ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
    ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1 --skip-build
}
